package com.xbongbong.pro.enums.permission.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.saas.enums.XbbRefTypeEnum;
import lombok.Getter;

import java.util.Objects;

/**
 * @author 张国徽
 * @version v1.0
 * @since v1.0
 */
@Getter
public enum ExportProPermissionAliasEnum {

    /**
     * tb_pro_promission对应的alias字段
     */
    CUSTOMER_EXPORT(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode(), "customerExport", ProPermissionAliasEnum.CUSTOMER_EXPORT.getI18nMemo()),

    OPPORTUNITY_EXPORT(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(), "opportunityExport", ProPermissionAliasEnum.OPPORTUNITY_EXPORT.getI18nMemo()),

    CONTRACT_EXPORT(XbbRefTypeEnum.CONTRACT.getCode(), "contractExport", ProPermissionAliasEnum.CONTRACT_EXPORT.getI18nMemo()),

    PRODUCT_EXPORT(XbbRefTypeEnum.PRODUCT.getCode(), "productExport", ProPermissionAliasEnum.PRODUCT_EXPORT.getI18nMemo()),

    PAYMENT_EXPORT(XbbRefTypeEnum.PAYMENT.getCode(), "paymentExport", ProPermissionAliasEnum.PAYMENT.getI18nMemo()),

    CUSTOMER_COMMUNICATE_EXPORT(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(), "customerCommunicateExport", ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_EXPORT.getI18nMemo()),

    STOCK_FLOW_BILL_EXPORT(XbbRefTypeEnum.STOCK_FLOW_BILL.getCode(), "stockFlowBillExport", ProPermissionAliasEnum.STOCK_FLOW_BILL_EXPORT.getI18nMemo()),

    STOCK_STANDING_BOOK_EXPORT(XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode(), "stockStandingBookExport", ProPermissionAliasEnum.STOCK_STANDING_BOOK_EXPORT.getI18nMemo()),

    SUPPLIER_EXPORT(XbbRefTypeEnum.SUPPLIER.getCode(), "supplierExport", ProPermissionAliasEnum.SUPPLIER_EXPORT.getI18nMemo()),

    INSTOCK_EXPORT(XbbRefTypeEnum.INSTOCK.getCode(), "instockExport", ProPermissionAliasEnum.INSTOCK_EXPORT.getI18nMemo()),

    OUTSTOCK_EXPORT(XbbRefTypeEnum.OUTSTOCK.getCode(), "outstockExport", ProPermissionAliasEnum.OUTSTOCK_EXPORT.getI18nMemo()),

    PURCHASE_EXPORT(XbbRefTypeEnum.PURCHASE.getCode(), "purchaseExport", ProPermissionAliasEnum.PURCHASE_EXPORT.getI18nMemo()),

    ASSEMBLE_EXPORT(XbbRefTypeEnum.ASSEMBLE.getCode(), "assembleExport", ProPermissionAliasEnum.ASSEMBLE_EXPORT.getI18nMemo()),

    INVENTORY_EXPORT(XbbRefTypeEnum.INVENTORY.getCode(), "inventoryExport", ProPermissionAliasEnum.INVENTORY_EXPORT.getI18nMemo()),

    TRANSFER_EXPORT(XbbRefTypeEnum.TRANSFER.getCode(), "transferExport", ProPermissionAliasEnum.TRANSFER_EXPORT.getI18nMemo()),

    RETURN_PURCHASE_EXPORT(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), "returnPurchaseExport", ProPermissionAliasEnum.RETURN_PURCHASE_EXPORT.getI18nMemo()),

    INVOICE_EXPORT(XbbRefTypeEnum.INVOICE.getCode(), "invoiceExport", ProPermissionAliasEnum.INVOICE_EXPORT.getI18nMemo()),

    PURCHASE_INVOICE_EXPORT(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(), "purchaseInvoiceExport", ProPermissionAliasEnum.PURCHASE_INVOICE_EXPORT.getI18nMemo()),

    WORK_REPORT_EXPORT(XbbRefTypeEnum.WORK_REPORT.getCode(), "workReportExport", ProPermissionAliasEnum.WORK_REPORT_EXPORT.getI18nMemo()),

    REFUND_EXPORT(XbbRefTypeEnum.REFUND.getCode(), "refundExport", ProPermissionAliasEnum.REFUND_EXPORT.getI18nMemo()),

    WORK_ORDER_EXPORT(XbbRefTypeEnum.WORK_ORDER.getCode(), "workOrderExport", ProPermissionAliasEnum.WORK_ORDER_EXPORT.getI18nMemo()),

    COMMUNICATE_PLAN_EXPORT(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), "communicatePlanExport", ProPermissionAliasEnum.COMMUNICATE_PLAN_EXPORT.getI18nMemo()),

    BOM_BILL_EXPORT(XbbRefTypeEnum.BOM_BILL.getCode(), "bomBillExport", ProPermissionAliasEnum.BOM_BILL_EXPORT.getI18nMemo()),

    PRODUCTION_ORDER_EXPORT(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), "productionOrderExport", ProPermissionAliasEnum.PRODUCTION_ORDER_EXPORT.getI18nMemo()),

    STOCK_SEARCH_EXPORT(XbbRefTypeEnum.STOCK_SEARCH.getCode(), "stockSearchExport", ProPermissionAliasEnum.STOCK_SEARCH_EXPORT.getI18nMemo()),

    SIGN_IN_EXPORT(XbbRefTypeEnum.SIGNIN.getCode(), "signInExport", ProPermissionAliasEnum.SIGN_IN_EXPORT.getI18nMemo()),

    PAY_PLAN_EXPORT(XbbRefTypeEnum.PAY_PLAN.getCode(), "payPlanExport", ProPermissionAliasEnum.PAY_PLAN_EXPORT.getI18nMemo()),

    // CHART_EXPORT(XbbRefTypeEnum.CHART.getCode(), "signInExport", ProPermissionAliasEnum.SIGN_IN_EXPORT.getI18nMemo()),

    SUPPLIER_CONTACT_EXPORT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), "supplierContactExport", ProPermissionAliasEnum.SUPPLIER_CONTACT_EXPORT.getI18nMemo()),

    SUPPLIER_COMMUNICATE_EXPORT(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), "supplierCommunicateExport", ProPermissionAliasEnum.SUPPLIER_COMMUNICATE_EXPORT.getI18nMemo()),

    QUOTATION_EXPORT(XbbRefTypeEnum.QUOTATION.getCode(), "quotationExport", ProPermissionAliasEnum.QUOTATION_EXPORT.getI18nMemo()),

    PAYMENT_SHEET_EXPORT(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), "paymentSheetExport", ProPermissionAliasEnum.PAYMENT_SHEET_EXPORT.getI18nMemo()),

    PURCHASE_INSTOCK_EXPORT(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), "purchaseInstockExport", ProPermissionAliasEnum.PURCHASE_INSTOCK_EXPORT.getI18nMemo()),

    REFUND_INSTOCK_EXPORT(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), "refundInstockExport", ProPermissionAliasEnum.REFUND_INSTOCK_EXPORT.getI18nMemo()),

    PRODUCTION_INSTOCK_EXPORT(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), "productionInstockExport", ProPermissionAliasEnum.PRODUCTION_INSTOCK_EXPORT.getI18nMemo()),

    RETURNED_MATERIEL_INSTOCK_EXPORT(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), "returnedMaterielInstockExport", ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_EXPORT.getI18nMemo()),

    CONTRACT_OUTSTOCK_EXPORT(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), "contractOutstockExport", ProPermissionAliasEnum.CONTRACT_OUTSTOCK_EXPORT.getI18nMemo()),

    RETURNED_PURCHASE_OUTSTOCK_EXPORT(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), "returnedPurchaseOutstockExport", ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_EXPORT.getI18nMemo()),

    PRODUCTION_MATERIEL_OUTSTOCK_EXPORT(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), "materielOutstockExport", ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_EXPORT.getI18nMemo()),

    WORK_ORDER_OUTSTOCK_EXPORT(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), "workOrderOutstockExport", ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_EXPORT.getI18nMemo()),

    PAY_SHEET_EXPORT(XbbRefTypeEnum.PAY_SHEET.getCode(), "paySheetExport", ProPermissionAliasEnum.PAY_SHEET_EXPORT.getI18nMemo()),

    BATCH_FLOW_BILL_EXPORT(XbbRefTypeEnum.BATCH_FLOW_BILL.getCode(), "batchFlowBillExport", ProPermissionAliasEnum.BATCH_FLOW_BILL_EXPORT.getI18nMemo()),

    SEQ_SEARCH_EXPORT(XbbRefTypeEnum.SEQ_SEARCH.getCode(), "productSerialBalanceExport", ProPermissionAliasEnum.SEQ_SEARCH_EXPORT.getI18nMemo()),

    MARKET_ACTIVITY_EXPORT(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(), "marketActivityExport", ProPermissionAliasEnum.MARKET_ACTIVITY_EXPORT.getI18nMemo()),

    CLUE_EXPORT(XbbRefTypeEnum.CLUE.getCode(), "clueExport", ProPermissionAliasEnum.CLUE_EXPORT.getI18nMemo()),

    WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(),ProPermissionAliasEnum.WORK_ORDER_V2_EXPORT.getAlias(),ProPermissionAliasEnum.WORK_ORDER_V2_EXPORT.getI18nMemo()),
    SERVICE_PROJECT(XbbRefTypeEnum.SERVICE_PROJECT.getCode(),ProPermissionAliasEnum.SERVICE_PROJECT_EXPORT.getAlias(),ProPermissionAliasEnum.SERVICE_PROJECT_EXPORT.getI18nMemo()),
    RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(),ProPermissionAliasEnum.RECEIPT_ORDER_EXPORT.getAlias(),ProPermissionAliasEnum.RECEIPT_ORDER_EXPORT.getI18nMemo()),
    SLA_LOG(XbbRefTypeEnum.SLA_LOG.getCode(),ProPermissionAliasEnum.SLA_LOG_EXPORT.getAlias(),ProPermissionAliasEnum.SLA_LOG_EXPORT.getI18nMemo()),
    ;

    private Integer code;

    private String alias;

    private String memo;

    ExportProPermissionAliasEnum(Integer code, String alias, String memo) {
        this.code = code;
        this.alias = alias;
        this.memo = memo;
    }

    public static ExportProPermissionAliasEnum getByCode(Integer businessType) {
        for (ExportProPermissionAliasEnum item: values()) {
            if (Objects.equals(item.getCode(), businessType)) {
                return item;
            }
        }
        return null;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }
}
